#!/usr/bin/python3
import os
import pandas as pd

face_attr_list_file = r'/rootfs/media/kasim/Data1/data/VideoFaceImage/image_list.attr.txt'


def main():
    # file_name;bin_pitch;bin_roll;bin_yaw;pitch;roll;yaw;quality;mask
    attr_cvs = pd.read_csv(face_attr_list_file, sep=';')
    file_names = attr_cvs['file_name']

    file_count = 0
    out_file_path = os.path.join(os.path.dirname(face_attr_list_file), 'image_list.txt')
    with open(out_file_path, 'w') as file:
        for file_name in file_names:
            file.write(file_name + '\n')
            file_count += 1
            if file_count % 10000 == 0:
                print('Process Filter File Count: {}'.format(file_count))
    print('Process Filter File Count: {}'.format(file_count))
    os.system('chmod a+wr {}'.format(out_file_path))


if __name__ == '__main__':
    main()
